float4x4 lightWorldViewProjection;
float	 maxDepth;

struct InputVertex
{
	float4 Position		: POSITION;
};

struct OutputVertex
{
	float4 Position		: POSITION;
	float3 Position2D	: TEXCOORD0;
};

struct OutputPixel
{
	float4 Color		: COLOR0;
};

OutputVertex ShadowMapVertexShader( InputVertex input )
{
	OutputVertex output = (OutputVertex)0;
	
	output.Position	  = mul( input.Position, lightWorldViewProjection );
	output.Position2D = input.Position;
	
	return output;
}

OutputPixel ShadowMapPixelShader( OutputVertex input )
{
	OutputPixel output = (OutputPixel)0;
	
	output.Color = input.Position2D.z / maxDepth;
	
	return output;
}

technique ShadowMap
{
    pass Pass0
    {
        VertexShader	= compile vs_2_0 ShadowMapVertexShader();
        PixelShader		= compile ps_2_0 ShadowMapPixelShader();
    }
}